import Vue from "vue";
import Vuex from "vuex";
import persistence from "vuex-uniapp-persistence";
Vue.use(Vuex);
const store = new Vuex.Store({
  plugins: [persistence()],
  state: {
    userName: "美女阿飘",
  },
  getters: {
    editName: (state) => state.userName + "好好",
  },
  mutations: {
    changeName(state, payload) {
      state.userName = payload;
    },
  },
  actions: {
    addName(state, payload) {
      // state.userName = state.userName + payload;
      state.commit("changeName", payload);
    },
  },
  modules: {},
});
export default store;
